package Math;

public class _168_ExcelSheetColumnTitle {
    //note 1:ascii number and character's translate
    //note 2:when remainder equals 0
    //note 3:can't compare to 26 system(e.p:binary system,octonary system)
    //note 4:converse to 26 system
    public String convertToTitle(int n) {
        StringBuffer result = new StringBuffer();
        int res = n;
        while (res!=0) {
            res--;
            result.append((char) (65 + res % 26));
            res /= 26;
        }
        return result.reverse().toString();
    }
}
